﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess.Classes;
using DataAccess;

public partial class Products : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) { PopulateControls(); }
    }
    private void PopulateControls() 
    { 
        string prodId = Request.QueryString["ProductID"];
        HangHoa data = HangHoa.Single(prodId);
        ChiTietHangHoa dt = ChiTietHangHoa.Single(prodId);
        if (data != null) 
        {
            lblName.Text = data.TenHangHoa;
            lblCPU.Text = dt.CPU;
            lblRam.Text = dt.Ram;
            lblHDD.Text = dt.HDD;
            lblVGA.Text = dt.VGA;
            lblDisplay.Text = dt.Display;
            lblWebcam.Text = dt.Webcam;
            lblLan.Text = dt.Lan;
            lblwifi.Text = dt.Wifi;
            lblPin.Text = dt.Pin;
            lblweight.Text = dt.TrongLuong;
            lblPrice.Text = (data.GiaMua).ToString();
            //lblDes.Text = HttpUtility.HtmlEncode(data.Description);
            //lblPrice.Text = string.Format("{0:c}", data.Price);
            prodImage.ImageUrl = Link.ToProductImage(data.HinhAnh);
            lnkAddToCart.NavigateUrl = Link.ToAddToCart(prodId); 
        }
    }

}